﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Leader : MonoBehaviour
{
    public void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag=="Player")
        {
            var controller= collision.GetComponent<PlayerController2D>();
            if (controller!=null)
            {
                controller.SetLeader(true);
            }
        }
    }
    public void OnTriggerExit2D(Collider2D collision)
    {
        if (collision.tag == "Player")
        {
            var controller = collision.GetComponent<PlayerController2D>();
            if (controller != null)
            {
                controller.SetLeader(false);
                controller.transform.position = controller.transform.position + Vector3.up * 0.05f;
            }
            UIManager.Instance.CloseSaveTip();
        }
    }
    public void OnTriggerStay2D(Collider2D collision)
    {
        if (collision.tag == "Player")
        {
            UIManager.Instance.OpenSaveTip("Up",transform,Vector3.zero);
        }
    }
}
